<!--{subtemplate inc/header}-->
<script type="text/javascript">
<!--{dynamic getGoodsDynamics args=$goods_result['ids']}-->
</script>
<!--{advlayout id="首页顶部通栏广告宽990px"}-->
<div class="blank12"></div>
<div class="hbox">
	<div id="body-left" class="fl">
		<!--2011-03-03 begin-->
		<!--{dynamic getTopBestGroup}-->
		<dl class="site-list site-list-tabs">
			<dt>
				<ul>
					<li class="current" rel="0"><p><a href="javascript:;">$_FANWE[current_city][name]团购网</a></p></li>
					<!--{loop $_FANWE['cache']['site_cate'] $site_cate}-->
					<!--{eval 
							loadCache('site_cate_'.$site_cate['id'].'_'.CURRENT_CITY_PY);
							$sc_sites = $_FANWE['cache']['site_cate_'.$site_cate['id'].'_'.CURRENT_CITY_PY];
						}-->
					<!--{if !empty($sc_sites) && count($sc_sites) > 0}-->
					<li rel="$site_cate[id]"><p><a href="javascript:;">{$_FANWE[current_city][name]}{$site_cate[name]}</a></p></li>
					<!--{/if}-->
					<!--{/loop}-->
				</ul>
			</dt>
			<dd rel="0">
				<!--{loop $site_list $city_site_id}-->
				<!--{eval $site = $_FANWE['cache']['site']['all']['s_'.$city_site_id];}-->
				<div class="sia {if $city_site_id = $site_id}current{/if}">
					<a class="siag" target="_blank" href="$site[url]" title="查看【$site[name]】详细" {if !empty($site['name_color'])}style="color:$site[name_color]"{/if}>{if !empty($site['name_style'])}<$site[name_style]>$site[name]</$site[name_style]>{else}$site[name]{/if}</a>
					<div>
					<!--{if $site['is_auth'] == 1}-->
					<span title="{lang auth}" class="auth"></span>
					<!--{/if}-->
					<a title="进入【$site[name]】" target="_blank" class="goweb" href="$site[go_url]">$site[name]</a>
					</div>
				</div>
				<!--{/loop}-->
			</dd>
			<!--{loop $_FANWE['cache']['site_cate'] $site_cate}-->
			<!--{eval $sc_sites = $_FANWE['cache']['site_cate_'.$site_cate['id'].'_'.CURRENT_CITY_PY]; }-->
			<!--{if !empty($sc_sites) && count($sc_sites) > 0}-->
			<!--{eval $sc_sites = array_slice($sc_sites,0,$_FANWE['setting']['index_site_count']);}-->
			<dd class="hidden" rel="$site_cate[id]">
				<!--{loop $sc_sites $sc_site_id}-->
				<!--{if $site_cate['site_type'] == 0}-->
				<!--{eval $site = $_FANWE['cache']['site']['all']['s_'.$sc_site_id];}-->
				<div class="sia {if $sc_site_id = $site_id}current{/if}">
					<a class="siag" target="_blank" href="$site[url]" title="查看【$site[name]】详细" {if !empty($site['name_color'])}style="color:$site[name_color]"{/if}>{if !empty($site['name_style'])}<$site[name_style]>$site[name]</$site[name_style]>{else}$site[name]{/if}</a>
					<div>
					<!--{if $site['is_auth'] == 1}-->
					<span title="{lang auth}" class="auth"></span>
					<!--{/if}-->
					<a title="进入【$site[name]】" target="_blank" class="goweb" href="$site[go_url]">$site[name]</a>
					</div>
				</div>
				<!--{else}-->
				<!--{eval $site = $_FANWE['cache']['site']['all_other']['s_'.$sc_site_id];}-->
				<div class="sia">
					<a class="siag" target="_blank" href="$site[url]" title="进入【$site[name]】" {if !empty($site['name_color'])}style="color:$site[name_color]"{/if}>{if !empty($site['name_style'])}<$site[name_style]>$site[name]</$site[name_style]>{else}$site[name]{/if}</a>
					<div>
					<!--{if $site['is_auth'] == 1}-->
					<span title="{lang auth}" class="auth"></span>
					<!--{/if}-->
					</div>
				</div>
				<!--{/if}-->
				<!--{/loop}-->
			</dd>
			<!--{/if}-->
			<!--{/loop}-->
		</dl>
		<!--2011-03-03 end-->
		<div class="blank9"></div>
		<div class="goods-list-top">
			<div class="display {dynamic getDisplayMode}">
				<a href="javascript:;" class="d_grid" mode="grid">网格</a>
				<a href="javascript:;" class="d_row" mode="row">列表</a>
			</div>
			<div class="actions">
				<a href="{u now/index}" class="current">所有团购</a>
				<a href="{u now/today}">今日发布</a>
				<a href="{u now/custom}">个人定制</a>
			</div>
			<div class="sort">
				<a href="javascript:;" class="default" sort="">默认排序</a>
				<a href="javascript:;" sort="spa">价格排序</a>
				<a href="javascript:;" sort="da">折扣排序</a>
				<a href="javascript:;" sort="bd">销量排序</a>
				<a href="javascript:;" sort="eta">时间排序</a>
			</div>
			<div class="prices">
				<a href="javascript:;" class="current" price="0,0">所有价格</a>
				<a href="javascript:;" price="0,100">0-100元</a>
				<a href="javascript:;" price="100,300">100-300元</a>
				<a href="javascript:;" price="300,500">300-500元</a>
				<a href="javascript:;" price="500,0">500元以上</a>
			</div>
		</div>
		<!--{if $city_areas !== false}-->
		<div class="goods-areas">
			<strong>商圈</strong>
			<!--{eval $area_index = 0;}-->
			<!--{loop $_FANWE['cache']['city_area_'.CURRENT_CITY_PY]['roots'] $rootid}-->
			<!--{eval $area = $_FANWE['cache']['city_area_'.CURRENT_CITY_PY]['all'][$rootid]; }-->
			<!--{if $area_index < 9}-->
			<a href="javascript:;" areaID="$rootid">$area['name']<span>$city_areas['areas'][$area['name']]</span></a>
			<!--{eval $area_index++;}-->
			<!--{/if}-->
			<!--{/loop}-->
			<a href="javascript:;" areaID="0">更多»</a>
		</div>
		<!--{/if}-->
		<div id="goods_list_body" class="goods-{dynamic getDisplayMode}-body">
			<!--{loop $_FANWE['cache']['goods']['root_cates'] $rootid}-->
			<!--{eval $root_count = $goods_cates['cates'][$rootid];}-->
			<!--{eval $cate_first = ' cate_first';}-->
			<!--{if $root_count > 0}-->
			<!--{eval $root_cate = $_FANWE['cache']['goods']['cats'][$rootid];}-->
			<div class="glb-cate list-cats $cate_first">
				<div class="glbc-root">
					$root_cate['name']
				</div>
				<div class="glbc-sub">
					<!--{eval $cate_index = 0;}-->
					<!--{loop $root_cate['childs'] $childid}-->
					<!--{if $cate_index < 6}-->
					<!--{eval $cate = $_FANWE['cache']['goods']['cats'][$childid];}-->
					<!--{eval $cat_count = $goods_cates['cates'][$childid];}-->
					<!--{if $cat_count > 0}-->
					<a href="javascript:;" cateID="$childid">$cate['name']<span>$cat_count</span></a>
					<!--{eval $cate_index++;}-->
					<!--{/if}-->
					<!--{else}-->
					<!--{eval break;}-->
					<!--{/if}-->
					<!--{/loop}-->
					<a href="javascript:;" cateID="$rootid">更多»</a>
				</div>
			</div>
			<!--{eval $cate_first = '';}-->
			<div class="glb-list">
				<ul>
					<!--{loop $goods_result['cates'][$rootid]['list'] $goods}-->
					<!--{if defined('IS_CACHE_TPL')}-->
					<!--{eval $goods['bought'] = '<script type="text/javascript">document.write(goodsDynamics["g_'.$goods['id'].'"]["bought"]);</script>';}-->
					<!--{eval $goods['post_count'] = '<script type="text/javascript">document.write(goodsDynamics["g_'.$goods['id'].'"]["post"]);</script>';}-->
					<!--{eval $goods['collect_count'] = '<script type="text/javascript">document.write(goodsDynamics["g_'.$goods['id'].'"]["collect"]);</script>';}-->
					<!--{eval $goods['click_count'] = '<script type="text/javascript">document.write(goodsDynamics["g_'.$goods['id'].'"]["click"]);</script>';}-->
					<!--{/if}-->
					<li class="item">
						<div class="site_gname">
							<div class="site">
								<a href="$goods[site_url]" target="_blank">$goods[site_name]</a>
							</div>
							<div class="name">
								<a href="$goods[url]" target="_blank" title="{$goods[site_name]}：{$goods[city]}今日团购:$goods[name]" style="text-align:left;">$goods[name]</a>
							</div>
						</div>
						<div class="img">
							<a href="$goods[url]" target="_blank"><img src="$goods[small_img]" alt="{$goods[site_name]}：{$goods[city]}今日团购:$goods[name]" /></a>
						</div>
						<div class="attrs-list">
							<p class="sprice al">现价：<span>$goods[shop_price_format]</span></p>
							<p class="bought ar">销量：<span>$goods[bought]</span></p>
							<p class="mprice al">原价：<b>$goods[market_price_format]</b></p>
							<p class="post ar">评论：<span>$goods[post_count]</span></p>
							<p class="discount al">折扣：<span>$goods[discount]</span>折</p>
							<p class="collect ar">收藏：<span>$goods[collect_count]</span></p>
							<p class="buy al"><a href="$goods[url]" target="_blank"><img src="{TPL_PATH}images/btn-1.gif" /></a></p>
							<p class="click ar">点击：<span>$goods[click_count]</span></p>
						</div>
						<div class="attrs-text attrs1">
							现价：<span class="sprice">$goods[shop_price_format]</span>
							原价：<b>$goods[market_price_format]</b>
							折扣：<span>$goods[discount]折</span>
							销量：<span>$goods[bought]</span>
						</div>
						<div class="attrs-text attrs2">
							<p class="post">评论：<span>$goods[post_count]</span></p>
							<p class="collect">收藏：<span>$goods[collect_count]</span></p>
							<p class="click">点击：<span>$goods[click_count]</span></p>
							<p class="buy"><a href="$goods[url]" target="_blank"><img src="{TPL_PATH}images/btn-1.gif" /></a></p>
						</div>
						<div class="time settime" endTime="$goods[end_time]">
							$goods[end_time_lag]
						</div>
						<!--{if $goods['is_best'] == 1}-->
						<span class="best"></span>
						<!--{elseif $goods['is_new'] == 1}-->
						<span class="new"></span>
						<!--{/if}-->
					</li>
					<!--{/loop}-->
				</ul>
			</div>
			<!--{if $root_count - count($goods_result['cates'][$rootid]['list']) > 0}-->
			<div class="glb-more list-cats">
				<a href="javascript:;" cateID="$rootid">还有 <span>{eval echo $root_count - count($goods_result['cates'][$rootid]['list'])}</span> 个【$root_cate['name']】团购供您选择，查看更多>></a>
			</div>
			<!--{/if}-->
			<!--{/if}-->
			<!--{/loop}-->
			<div class="blank20"></div>
		</div>
	</div>
	<div id="body-right" class="fr">
	<!--{subtemplate inc/common/right}-->
	</div>
</div>
<script type="text/javascript">
var cat = "$cate_id";
var area = "$area_id";
var city = "{CURRENT_CITY_PY}";
var sortOrder = "$sort";
var prices = "{$prices}";
var route = $_FANWE['setting']['url_route'];
var depr = "-";
var indexUrl = decodeURIComponent("{echo U('now/'.ACTION_NAME,array('cat'=>'_cat_','city_py'=>'_city_','sort'=>'_sort_','prices'=>'_prices_','area'=>'_area_'))}");
var customSiteCount = 12;

jQuery(function($){
	$(".img img").lazyload({"placeholder":"{TPL_PATH}images/img_loading.gif","failurelimit":10});
	
	$(".sia").hover(function(){
		$(".sia").removeClass("active");
		$(this).addClass("active");
	},function(){
		$(this).removeClass("active");
	});
	
	$(".list-cats a").click(function(){
		cat = this.getAttribute("cateID");
		goToUrl();
	});
	
	$(".goods-areas a").click(function(){
		area = this.getAttribute("areaID");
		goToUrl();
	});
	
	$(".goods-list-top .sort a").click(function(){
		sortOrder = this.getAttribute("sort");
		goToUrl();
	});
	
	$(".goods-list-top .prices a").click(function(){
		prices = this.getAttribute("price");
		goToUrl();
	});
	
	$(".display a").click(function(){
		mode = this.getAttribute("mode");
		$.cookie(COOKIE_PRE + 'display_mode', mode,{"expires":7});
		$("#goods_list_body").attr("className","goods-"+mode+"-body");
		$(".goods-list-top .display").attr("className","display "+mode);	
	});
	
	//2011-03-03 update
	$(".site-list-tabs li").click(function(){
		var rel = this.getAttribute("rel");
		$(".site-list-tabs li").removeClass("current");
		$(this).addClass("current");
		$(".site-list-tabs dd").hide();
		$(".site-list-tabs dd[rel='"+ rel +"']").show();
	});
	
	//2011-03-03 update
	$(".site-list-tabs li a").focus(function(){
		this.blur();
	});
	
});

function getCustomSiteInfo()
{
	var siteIds = '';
	$(".select_sites .sites_box label input").each(function(i){
		if(this.checked)
		{
			if(siteIds == '')
				siteIds += this.value;
			else
			{
				if((','+siteIds+',').indexOf(','+this.value+',') < 0)
					siteIds+= ',' + this.value;
			}
		}
	});
	
	if(siteIds != '')
		return [siteIds,siteIds.split(',').length];
	else
		return ['',0];
}

function goToUrl()
{
	if(cat == 0)
		indexUrl = clearParm(indexUrl,'_cat_',"",'cat');
	else
		indexUrl = clearParm(indexUrl,'_cat_',cat,'cat');
		
	if(area == 0)
		indexUrl = clearParm(indexUrl,'_area_',"",'area');
	else
		indexUrl = clearParm(indexUrl,'_area_',area,'area');
	
	if(prices == "0,0")
		indexUrl = clearParm(indexUrl,'_prices_',"",'prices');
	else
		indexUrl = clearParm(indexUrl,'_prices_',prices,'prices');
	
	indexUrl = clearParm(indexUrl,'_city_',city,'city_py');
	indexUrl = clearParm(indexUrl,'_sort_',sortOrder,'sort');
    
    //2011-02-10 update
    var fun = function(){
        location.href=indexUrl;
    };

    setTimeout(fun,1);
}

function clearParm(url,search,replace,parm)
{
	if(replace == "")
	{
		if(route > 0)
			return url.replace(depr+parm+depr+search,"");
		else
			return url.replace("&"+parm+"="+search,"");
	}
	else
		return url.replace(search,replace);
}
</script>
<!--{subtemplate inc/footer}-->